// ajaxPrefilter  配置ajax
let baseUrl = 'http://www.itcbc.com:8080'
$.ajaxPrefilter(function (option) {
  // 1配置链接
  option.url = baseUrl + option.url
  //2 配置登录注册出错
  option.complete = function (xhr) {
    // console.log(xhr);
    let res = xhr.responseJSON
    if (res.status === 1) {
      layer.msg(res.message)
    }
    // 判断token真假,清除token并跳转
    if (res.status === 1 && res.message === '身份认证失败') {
      localStorage.removeItem('token')
      location.href = './login.html'
    }

  }
  // 3配置请求头
  option.headers = {
    Authorization : localStorage.getItem('token')
  }
})